package ee.ttu.karileet.serviceshop.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ee.ttu.karileet.serviceshop.dao.UserAccountDAO;
import ee.ttu.karileet.serviceshop.model.UserAccount;
import ee.ttu.karileet.serviceshop.service.UserAccountService;

@Service("userAccountService")
public class UserAccountServiceImpl implements UserAccountService {

	@Autowired
	private UserAccountDAO userAccountDao;
	
	@Override
	@Transactional
	public void insertUser(UserAccount userAccount) {
		userAccountDao.insertUserAccount(userAccount);
	}

	@Override
	@Transactional
	public UserAccount getUserById(long userId) {
		return userAccountDao.getUserAccountById(userId);
	}

	@Override
	@Transactional
	public UserAccount getUser(String username) {
		return userAccountDao.getUserAccount(username);
	}

	@Override
	@Transactional
	public List<UserAccount> getUsers() {
		return userAccountDao.getUserAccounts();
	}

}
